//
//  SYRequestAPI+SYXiaoXi.m
//  SanYiTeaching
//
//  Created by 郑浩然 on 2019/6/13.
//  Copyright © 2019年 SanYi. All rights reserved.
//

#import "SYRequestAPI+SYXiaoXi.h"
#import "CuoTiLvModel.h"

@implementation SYRequestAPI (SYXiaoXi)
//获取考勤异常统计
+ (void)sy_getAttendanceStudentInfoMsgid:(NSString *)msgId
                                isAttend:(NSString *)isAttend
                                 success:(void(^)(NSMutableArray *dataListArr))success
                                    fail:(FailBlock)fail
{
    NSString *urlStr = @"notice/NoticeReceiveService.svc/GetAttendanceStudentInfo";
    
    NSDictionary *dict = @{@"msgId":msgId,
                           @"isAttend":isAttend
                           };
    
    [SYRequestAPI postDataFromURLScheme:urlStr parameterDictionary:dict success:^(id responseObject) {
        
        NSArray *dataArr = responseObject[@"data"];
        NSMutableArray *dataLlistArr = [NSMutableArray array];
        for (NSDictionary *dict in dataArr) {
            SYKaoQinYiChangModel *kqycModel = [SYKaoQinYiChangModel yy_modelWithDictionary:dict];
            
            [dataLlistArr addObject:kqycModel];
        }
        if (success) {
            success(dataLlistArr);
        }
        
    } fail:^(NSError *error) {
        if (fail) {
            fail(error);
        }
    }];
}
//
+ (void)sy_getGetAttendanceStudentDetailInfoClassId:(NSString *)classId
                                          sutdentId:(NSString *)studentId
                                   totalLessonTimes:(NSString *)totalLessonTimes
                                            success:(void(^)(NSMutableArray *dataListArr))success
                                               fail:(FailBlock)fail
{
    NSString *urlStr = @"notice/NoticeReceiveService.svc/GetAttendanceStudentDetailInfo";
    
    NSDictionary *dict = @{@"ClassId":classId,
                           @"StudentId":studentId,
                           @"TotalLessonTimes":totalLessonTimes
                           };
    
    [SYRequestAPI postDataFromURLScheme:urlStr parameterDictionary:dict success:^(id responseObject) {
        
        NSArray *dataArr = responseObject[@"data"];
        NSMutableArray *dataLlistArr = [NSMutableArray array];
        for (NSDictionary *dict in dataArr) {
            SYKaoQinStudentsModel *kqycModel = [SYKaoQinStudentsModel yy_modelWithDictionary:dict];
            
            [dataLlistArr addObject:kqycModel];
        }
        if (success) {
            success(dataLlistArr);
        }
        
    } fail:^(NSError *error) {
        if (fail) {
            fail(error);
        }
    }];
}

+ (void)sy_getExamLastThreeStudentInfoMsgId:(NSString *)msgId
                                    success:(void(^)(NSMutableArray *dataListArr))success
                                       fail:(FailBlock)fail
{
    
    NSString *urlStr = @"notice/NoticeReceiveService.svc/GetExamLastThreeStudentInfo";
    
    NSDictionary *dict = @{
                           @"msgId":msgId
                           };
    
    [SYRequestAPI postDataFromURLScheme:urlStr parameterDictionary:dict success:^(id responseObject) {
        
        NSArray *dataArr = responseObject[@"data"];
        NSMutableArray *dataLlistArr = [NSMutableArray array];
        for (NSDictionary *dict in dataArr) {
            SYHoSanMingModel *kqycModel = [SYHoSanMingModel yy_modelWithDictionary:dict];
            
            [dataLlistArr addObject:kqycModel];
        }
        if (success) {
            success(dataLlistArr);
        }
        
    } fail:^(NSError *error) {
        if (fail) {
            fail(error);
        }
    }];
    
}

+ (void)sy_getGetQuestionWrongRateInfoClassId:(NSString *)messageID
                                      success:(void(^)(NSMutableArray *dataListArr))success
                                         fail:(FailBlock)fail{
    NSString *urlStr = @"notice/NoticeReceiveService.svc/GetQuestionWrongRateInfo";
    
    NSDictionary *dict = @{@"msgId":messageID};
    
    [SYRequestAPI postDataFromURLScheme:urlStr parameterDictionary:dict success:^(id responseObject) {
        
        NSArray *dataArr = responseObject[@"data"];
        NSMutableArray *dataLlistArr = [NSMutableArray array];
        for (NSDictionary *dict in dataArr) {
            CuoTiLvModel *kqycModel = [CuoTiLvModel yy_modelWithDictionary:dict];
            
            [dataLlistArr addObject:kqycModel];
        }
        if (success) {
            success(dataLlistArr);
        }
        
    } fail:^(NSError *error) {
        if (fail) {
            fail(error);
        }
    }];
}
//发送班级消息
+ (void)sy_getNoticeSendServiceSendNotice:(NSString *)messageID
                                      and:(NSString *)content
                                  success:(void(^)(NSMutableArray *dataListArr))success
                                     fail:(FailBlock)fail{
    NSString *urlStr = @"notice/NoticeReceiveService.svc/SendNotice";
    
    NSDictionary *dict = @{@"msgId":messageID};
    
    [SYRequestAPI postDataFromURLScheme:urlStr parameterDictionary:dict success:^(id responseObject) {
//        NSLog(@"发送班级消息成功 %@",responseObject);
//        NSArray *dataArr = responseObject[@"data"];
//        NSMutableArray *dataLlistArr = [NSMutableArray array];
//        for (NSDictionary *dict in dataArr) {
//            CuoTiLvModel *kqycModel = [CuoTiLvModel yy_modelWithDictionary:dict];
//
//            [dataLlistArr addObject:kqycModel];
//        }
//        if (success) {
//            success(dataLlistArr);
//        }
        
    } fail:^(NSError *error) {
        if (fail) {
            fail(error);
        }
    }];
}
@end















